<css href="/Public/design/iconfont/iconfont.css" />
<div class="widget-head" style="margin-top:0;">
    <div class="widget-title">地图模块管理</div>
</div>

<div class="layui-clear">
    <a class="layui-btn layui-btn-normal" href="javascript:;" style="margin-left:0" onclick="think_open('/game/admin/module_edit','新增地图模块',['70%','70%'],0)">新增地图模块</a>
    <a class="layui-btn layui-btn layui-btn-normal" href="/game/admin/editor.html" target="_blank" style="margin-left:0">地图编辑器</a>
    <a class="layui-btn layui-btn " href="/game/map/color.html" target="_blank" style="margin-left:0">色彩出题</a>
    <a class="layui-btn layui-btn " href="/game/map/memory.html" target="_blank" style="margin-left:0">记忆出题</a>
    <a class="layui-btn layui-btn " href="/game/map/music.html" target="_blank" style="margin-left:0">音乐出题</a>
    <a class="layui-btn layui-btn " href="/game/map/song.html" target="_blank" style="margin-left:0">歌曲出题</a>
    <a class="layui-btn layui-btn " href="/game/map/calc.html" target="_blank" style="margin-left:0">算术出题</a>
    <a class="layui-btn layui-btn " href="/game/map/excel.html" target="_blank" style="margin-left:0">题库出题</a>
    <!-- <a class="layui-btn layui-btn " href="javascript:;" style="margin-left:0" onclick="think_open('/game/admin/editor','地图编辑器',['100%','100%'],0)">地图编辑器</a> -->
    <form method="GET" action="{:U('index',['status'=>$cur_status])}" class="fr layui-form" style="width:330px;">
        <div class="layui-input-inline fl" style="width:100px;">
            <php>$types = ['A.name'=>'模块名称'];</php>
            <select name="searchtype">
                <foreach name="types" item="vo" key="k">
                    <option value="{$k}" <if condition="$_GET['searchtype'] eq $k">selected</if>>{$vo}</option>
                </foreach>
            </select>
        </div>
        <div class="layui-input-inline fr" style="width:230px;">
            <button class="layui-btn fr" lay-submit>搜索</button>
            <input type="text" class="layui-input fr" style="width:160px;" name="keywords" placeholder="请输入关键词" value="{$_GET['keywords']}">
        </div>
        <php> $condition = '';</php>
        <php> $condition .= $_GET['searchtype'] && $_GET['keywords'] ? "/searchtype/A.".$_GET['searchtype']."/keywords/".$_GET['keywords'] : '';</php>
        <script>
            var condition = '{$condition}';
        </script>
    </form>
</div>
<table id="list" lay-skin="line"></table>
<script type="text/html" id="barDemo">
    <div class="action-btn">
        <a class="mini_del" href="javascript:;" data-url="/game/api_admin/del_module/ids/{{d.id}}">删除</a>
        <a class="" href="javascript:;" onclick="think_open('/game/admin/module_edit?id={{d.id}}','修改地图模块',['70%','70%'],0)">修改</a>
    </div>
</script>

<script>
    layui.use(['jquery', 'think', 'table'], function() {
        var think = layui.think,
            $ = layui.jquery,
            table = layui.table;
        //第一个实例
        think.render({
                id: 'question-list',
                elem: '#list',
                method: 'post',
                skin: 'line',
                url: '/game/api_admin/getdata_module',
                // where: condition,
                page: true,
                size: 'lg',
                // toolbar: true,
                cols: [
                    [ //表头
                        {
                            type: 'checkbox'
                        }, {
                            field: 'id',
                            title: 'ID',
                            width: 90
                        }, {
                            field: 'name',
                            title: '模块名称'
                        }, {
                            field: 'key',
                            title: '模块Key'
                        }, {
                            field: 'icon',
                            title: '图标',
                            width: 80,
                            templet: function(d) {
                                return d.icon ? '<i class="iconfont ' + d.icon + '">' : '暂无';
                            }
                        }, {
                            field: 'status',
                            title: '状态',
                            width: 100,
                            templet: function(d) {
                                return d.status ? '<span class="xy-status">显示</span>' : '<span class="xy-status red">隐藏</span>';
                            }
                        }, {
                            field: 'listorder',
                            title: '排序值'
                        }, {
                            field: 'update_time',
                            title: '修改时间',
                            width: 177,
                            templet: function(d) {
                                return think_time(d.update_time, 'Y-m-d H:i:s');
                            }
                        }, {
                            title: '操作',
                            width: 120,
                            align: 'center',
                            toolbar: '#barDemo'
                        }
                    ]
                ]
            },
            '{$_GET["searchtype"]}',
            '{$_GET["keywords"]}');
    });
</script>